<template>
    <div class="logistics_info">
        <header-bar title="物流信息"></header-bar>
        <div class="logistics_status">
            <div class="status">
                <span>物流状态：</span>
                <span>{{logisticsStatus[logisticsData.logisticsStatus]}}</span>
            </div>
            <div class="logistics_type">
                承运来源：{{logisticsData.deliveryCompany}}
            </div>
            <div class="logistics_num">
                运单编号：{{logisticsData.deliveryNum}}
            </div>
        </div>
        <ul class="logistics_steps">
            <li v-for="(item,index) in logisticsData.trackVos" :key="index">
                <div class="step_left">
                    <div class="step_left_content">
                        <div>{{item.acceptTime.slice(5,10)}}</div>
                        <div>{{item.acceptTime.slice(-8,-3)}}</div>
                    </div>
                    <div class="step_left_icon">
                        <div class="circle" :class="index==0?'frist':''"></div>
                        <div class="border" v-if="logisticsData.trackVos.length!=(index+1)"></div>
                    </div>
                </div>
                <div class="step_right" :class="index==0?'frist':''" v-html="item.acceptStation">
                </div>
            </li>
        </ul>
    </div>
</template>

<script>
import HeaderBar from 'components/header.vue'
import { mapState, mapActions } from 'vuex'
export default {
    components: {
        HeaderBar,
    },
    created() {
        this.info();
    },
    data(){
        return {
            logisticsData:{},
            logisticsStatus:{
                '0':'无物流信息',
                '1':'已取件',
                '2':'在途中',
                '3':'签收'
            }
        }
    },
    methods:{
        ...mapActions(['showMsg', 'toggleLoading']),
        info(){
            let id = this.$route.query.id;
            this.toggleLoading({flag:true});
            this.$ajax.logisticsTrackInfo(this.$route.query.orderId).then(res=>{
                this.toggleLoading({flag:false});
                if(res.code=='0000'){
                    this.logisticsData = res.data;
                }
            })
        }
    }
}
</script>
<style scoped>
.logistics_info{
    padding-bottom: .4rem ;
}
.logistics_status {
  background: #ffffff;
  box-shadow: 0 1px 6px 0 #eeeeee;
  border-radius: 5px;
  margin: 0 0.3rem;
  padding: 0.3rem  0.4rem ;
}
.logistics_status .status {
  margin-bottom: 0.1rem ;
}
.logistics_status .status span {
  font-size: 0.36rem ;
  font-weight: 600;
}
.logistics_status .status span:nth-child(1) {
  color: #333333;
}
.logistics_status .status span:nth-child(2) {
  color: #ff9900;
}
.logistics_type,
.logistics_num {
  font-size: 0.24rem;
  color: #999999;
  line-height: 0.36rem;
}
.logistics_steps {
    margin-top: .64rem ;
    padding: 0 .5rem 0 .4rem ;
}
.logistics_steps li {
    display: flex;
}
.logistics_steps li .step_left {
    display: flex;
}
.step_left .step_left_content {
    width: .9rem ;
}
.step_left_icon{
    width: .32rem ;
    padding-top: .06rem;
}
.step_left_icon .circle {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #CCCCCC;
}
.step_left_icon .circle.frist {
    background: #14C878;
}
.step_left_icon .border {
    width: 1px;
    height: .96rem;
    background: #CCCCCC;
    margin-left: 2.5px;
    margin-top: 2px;
}
.logistics_steps li .step_right {
    font-size: .24rem;
    width: calc(100% - .9rem - .16rem);
    color: #999999;
}
.logistics_steps li .step_right.frist {
    color: #333333;
}
</style>

